import React, { Component } from 'react'
//  推荐将 BrowserRouter 重命名为 Router
import { Router, Route, Switch } from 'react-router-dom'

import Login from './pages/Login'
import Layout from './pages/Layout'
import AuthRouter from './Components/AuthRouter'
import history from './utils/history'

import TextPage from './pages/Text'
export default class App extends Component {
  render() {
    return <Router history = {history}>
      {/* React 路由中，默认是不会匹配到第一个就停止匹配 */}
      {/* Switch负责匹配到第一个组件后，就不再向后匹配 */}
      <Switch>
        <Route path="/text" component={TextPage}></Route>
        <Route path="/login" component={Login}></Route>
        <AuthRouter path="/" component={Layout}></AuthRouter>
      </Switch>
    </Router>
    
  }
}







